
var path = require('path')
//var webpack = require('webpack')
const htmlWebpackPlugin = require('html-webpack-plugin')
module.exports={
    //入口文件的配置项
    entry:{
        entry:path.join(__dirname, './src/main.js')
    },
    //出口文件的配置项
    output:{
        //输出的路径，用了Node语法
        path:path.join(__dirname,'./dist'),
        //输出的文件名称
        filename:'bundle.js'
    },
    //模块：例如解读CSS,图片如何转换，压缩
    module:{
    	rules:[
    	   {test:/\.css$/,use:['style-loader','css-loader']},
    	   { test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] },
    	   { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
    	   { test: /\.(png|jpg|gif)$/, use: 'url-loader?limit=7631&name=[hash:8]-[name].[ext]' },
    	   { test: /\.(ttf|eot|svg|woff|woff2)$/, use: 'url-loader' },
    	   { test: /\.js$/, use: 'babel-loader', exclude: /node_modules/ },
    	   { test: /\.vue$/, use: 'vue-loader' } 
    	]
    },
    //插件，用于生产模版和各项功能
    plugins:[
       new htmlWebpackPlugin({
       	template:path.join(__dirname,'./src/index.html'),
       	filename:'index.html'
       })
    ],
    //配置webpack开发服务功能
    devServer:{},
    resolve: {
	    alias: { // 修改 Vue 被导入时候的包的路径
	       "vue$": "vue/dist/vue.js"
	    }
  }
}